<?php
require_once 'connect.php';

mysql_select_db("imgapp");
date_default_timezone_set("UTC");
for($i=1;$i<=30;$i++){
	$fileName="./images/$i".".jpg";
	$time=date("Y-m-d H:i:s");
	$file_newName="./images/".time()."_".$i.".jpg";
	rename($fileName,$file_newName);
	$query="insert into imgfile(path,updatetime,imgdes,imgtitle,favor,hate,normal) values(
			'$file_newName','$time','img$i','Image $i',$i,0,0)";
	@mysql_query($query);	
	
	for($j=1;$j<=($i%6+1);$j++){
	$query="insert into imgfavor(iid,uid,type) values($i,'test$j',1)";
	@mysql_query($query);
	}
	
	$query="insert into imgcomment(iid,uid,comment,comtime) values($i,'test$i','com from test$i','$time')";
	@mysql_query($query);
	
	for($j=1;$j<=($i%3+1);$j++){
	$query="insert into imgforward(iid,uid,forward) values($i,'test$j',1)";
	@mysql_query($query);
	}
	
	sleep(1);
}

echo "ini done...";
?>